package com.edbergogroup.springexamples.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;

@Entity()
@Table(name="PERSON")
public class Person implements Serializable {

	public Person(String firstName, String lastName, Adress adress) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.adress = adress;
	}
	
	
	public Person() {
		// TODO Auto-generated constructor stub
	}

	private static final long serialVersionUID = -2752657026263134732L;
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer pid;

	@Column(name="F_NAME")
	private String firstName;
	@Column(name="L_NAME")
	private String lastName;

	@Embedded
	private Adress adress;
	
	@Version
	@Column(name="VERSION")
	private Integer version;
	
	public Integer getPid() {
		return pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public Adress getAdress() {
		return adress;
	}

	public void setAdress(Adress adress) {
		this.adress = adress;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public Integer getVersion() {
		return version;
	}

}
